import { ColumnGroupType, ColumnType } from "antd/es/table"

import { renderNullableValue, StyledParagraph } from "./venueProfitAndLoss"
import { calAccountStatus } from "./venueProfitLossDaily"

const businessProxyReport = (newFormat: (arg: string) => string): Record<string, ColumnGroupType<any> | ColumnType<any>> => ({
	proxyReportProxyAccount: {
		key: "proxyAccount",
		dataIndex: "proxyAccount",
		width: 120,
		render: renderNullableValue("proxyAccount"),
		title: newFormat("report.agent_number"),
		align: "center",
		fixed: "left"
	},
	proxyReportProxyLevel: {
		key: "proxyLevel",
		dataIndex: "proxyLevel",
		width: 120,
		render: renderNullableValue("proxyLevel"),
		title: newFormat("report.agency_level"),
		align: "center",
		fixed: false
	},
	proxyReportAccountType: {
		key: "accountType",
		dataIndex: "accountType",
		width: 120,
		render: (_text: any, record: any) => (
			<StyledParagraph $isCurved={false}>
				{newFormat(`label.member.${record.accountType === 1 ? "formal" : "failed"}`)}
			</StyledParagraph>
		),
		title: newFormat("report.account_type"),
		align: "center",
		fixed: false
	},
	proxyReportParentProxyAccount: {
		key: "parentProxyAccount",
		dataIndex: "parentProxyAccount",
		width: 120,
		render: renderNullableValue("parentProxyAccount"),
		title: newFormat("report.parent_proxy_name"),
		align: "center",
		fixed: false
	},
	proxyReportAccountLockStatus: {
		key: "accountLockStatus",
		dataIndex: "accountLockStatus",
		width: 120,
		render: (_text: any, record: any) => (
			<StyledParagraph $isCurved={true}>{calAccountStatus(newFormat)(record)}</StyledParagraph>
		),
		title: newFormat("report.account_status"),
		align: "center",
		fixed: false
	},
	proxyReportWindControlName: {
		key: "windControlName",
		dataIndex: "windControlName",
		width: 120,
		render: renderNullableValue("windControlName"),
		title: newFormat("report.risk_control_level"),
		align: "center",
		fixed: false
	},
	proxyReportLabelName: {
		key: "labelName",
		dataIndex: "labelName",
		width: 120,
		render: renderNullableValue("labelName"),
		title: newFormat("report.agent_tag"),
		align: "center",
		fixed: false
	},
	proxyReportRegisterAt: {
		key: "registerAt",
		dataIndex: "registerAt",
		width: 120,
		render: renderNullableValue("registerAt"),
		title: newFormat("report.register_dates"),
		align: "center",
		fixed: false
	},
	proxyReportRebateAmount: {
		key: "rebateAmount",
		dataIndex: "rebateAmount",
		width: 120,
		render: renderNullableValue("rebateAmount", "$"),
		title: newFormat("report.total_receive_rebate"),
		align: "center",
		fixed: false
	},
	proxyReportOtherAdjustAmount: {
		key: "otherAdjustAmount",
		dataIndex: "otherAdjustAmount",
		width: 120,
		render: renderNullableValue("otherAdjustAmount", "$"),
		title: newFormat("report.rebate_other_adjust"),
		align: "center",
		fixed: false
	},
	proxyReportCommissionAmount: {
		key: "commissionAmount",
		dataIndex: "commissionAmount",
		width: 120,
		render: renderNullableValue("commissionAmount", "$"),
		title: newFormat("report.total_receive_person_brokerage"),
		align: "center",
		fixed: false
	},
	proxyReportCommissionAdjustAmount: {
		key: "commissionAdjustAmount",
		dataIndex: "commissionAdjustAmount",
		width: 120,
		render: renderNullableValue("commissionAdjustAmount", "$"),
		title: newFormat("report.rebate_commission_other_adjust"),
		align: "center",
		fixed: false
	},
	proxyReportFirstDeposit: {
		key: "firstDeposit",
		dataIndex: "firstDeposit",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("firstDeposit", "$")(_text, record)} {renderNullableValue("firstDepositDatetime")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.first_deposit_amount")}</p>
				<p>{newFormat("report.first_deposit_time")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportDepositAmount: {
		key: "depositAmount",
		dataIndex: "depositAmount",
		width: 120,
		render: renderNullableValue("depositAmount", "$"),
		title: newFormat("report.deposit_amount"),
		align: "center",
		fixed: false
	},
	proxyReportDepositTimes: {
		key: "depositTimes",
		dataIndex: "depositTimes",
		width: 120,
		render: renderNullableValue("depositTimes"),
		title: newFormat("report.deposit_times"),
		align: "center",
		fixed: false
	},
	proxyReportWithdrawAmount: {
		key: "withdrawAmount",
		dataIndex: "withdrawAmount",
		width: 120,
		render: renderNullableValue("withdrawAmount", "$"),
		title: newFormat("report.withdraw_amount"),
		align: "center",
		fixed: false
	},
	proxyReportWithdrawTimes: {
		key: "withdrawTimes",
		dataIndex: "withdrawTimes",
		width: 120,
		render: renderNullableValue("withdrawTimes"),
		title: newFormat("report.withdraw_times"),
		align: "center",
		fixed: false
	},
	proxyReportDepositWithdrawDifferAmount: {
		key: "depositWithdrawDifferAmount",
		dataIndex: "depositWithdrawDifferAmount",
		width: 120,
		render: renderNullableValue("depositWithdrawDifferAmount", "$"),
		title: newFormat("report.deposit_withdraw_differ_amount"),
		align: "center",
		fixed: false
	},
	proxyReportOfficerProxyCashUpAmount: {
		key: "officerProxyCashUpAmount",
		dataIndex: "officerProxyCashUpAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("officerProxyCashUpAmount", "$")(_text, record)}{" "}
				{renderNullableValue("officerProxyCashUpTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.official_give_agent_recharge_up_points")}</p>
				<p>{newFormat("report.recharge_up_points_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportProxyBeCashUpAmount: {
		key: "proxyBeCashUpAmount",
		dataIndex: "proxyBeCashUpAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("proxyBeCashUpAmount", "$")(_text, record)}{" "}
				{renderNullableValue("proxyBeCashUpTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.agent_superior_recharge_up_points")}</p>
				<p>{newFormat("report.recharge_up_points_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportProxyToChildCashUpAmount: {
		key: "proxyToChildCashUpAmount",
		dataIndex: "proxyToChildCashUpAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("proxyToChildCashUpAmount", "$")(_text, record)}{" "}
				{renderNullableValue("proxyToChildCashUpTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.agent_give_subordinate_recharge_up_points")}</p>
				<p>{newFormat("report.recharge_up_points_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportProxyToMemCashUpAmount: {
		key: "proxyToMemCashUpAmount",
		dataIndex: "proxyToMemCashUpAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("proxyToMemCashUpAmount", "$")(_text, record)}{" "}
				{renderNullableValue("proxyToMemCashUpTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.agent_give_member_recharge_up_points")}</p>
				<p>{newFormat("report.recharge_up_points_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportOfficerProxyCashDownAmount: {
		key: "officerProxyCashDownAmount",
		dataIndex: "officerProxyCashDownAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("officerProxyCashDownAmount", "$")(_text, record)}{" "}
				{renderNullableValue("officerProxyCashDownTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.official_give_agent_withdrawal_down_points")}</p>
				<p>{newFormat("report.withdrawal_down_points_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportProxyBeCashDownAmount: {
		key: "proxyBeCashDownAmount",
		dataIndex: "proxyBeCashDownAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("proxyBeCashDownAmount", "$")(_text, record)}{" "}
				{renderNullableValue("proxyBeCashDownTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.agent_superior_withdrawal_down_points")}</p>
				<p>{newFormat("report.withdrawal_down_points_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportProxyToChildCashDownAmount: {
		key: "proxyToChildCashDownAmount",
		dataIndex: "proxyToChildCashDownAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("proxyToChildCashDownAmount", "$")(_text, record)}{" "}
				{renderNullableValue("proxyToChildCashDownTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.agent_give_subordinate_withdrawal_down_points")}</p>
				<p>{newFormat("report.withdrawal_down_points_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportProxyToMemCashDownAmount: {
		key: "proxyToMemCashDownAmount",
		dataIndex: "proxyToMemCashDownAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("proxyToMemCashDownAmount", "$")(_text, record)}{" "}
				{renderNullableValue("proxyToMemCashDownTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.agent_give_member_withdrawal_down_points")}</p>
				<p>{newFormat("report.withdrawal_down_points_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportOfficerProxyCreditUpAmount: {
		key: "officerProxyCreditUpAmount",
		dataIndex: "officerProxyCreditUpAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("officerProxyCreditUpAmount", "$")(_text, record)}{" "}
				{renderNullableValue("officerProxyCreditUpTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.official_give_agent_credit_up_points")}</p>
				<p>{newFormat("report.credit_up_points_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportProxyBeCreditUpAmount: {
		key: "proxyBeCreditUpAmount",
		dataIndex: "proxyBeCreditUpAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("proxyBeCreditUpAmount", "$")(_text, record)}{" "}
				{renderNullableValue("proxyBeCreditUpTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.agent_superior_credit_up_points")}</p>
				<p>{newFormat("report.credit_up_points_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportProxyToChildCreditUpAmount: {
		key: "proxyToChildCreditUpAmount",
		dataIndex: "proxyToChildCreditUpAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("proxyToChildCreditUpAmount", "$")(_text, record)}{" "}
				{renderNullableValue("proxyToChildCreditUpTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.agent_give_subordinate_credit_up_points")}</p>
				<p>{newFormat("report.credit_up_points_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportProxyToMemCreditUpAmount: {
		key: "proxyToMemCreditUpAmount",
		dataIndex: "proxyToMemCreditUpAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("proxyToMemCreditUpAmount", "$")(_text, record)}{" "}
				{renderNullableValue("proxyToMemCreditUpTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.agent_give_member_credit_up_points")}</p>
				<p>{newFormat("report.credit_up_points_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportOfficerProxyCreditDownAmount: {
		key: "officerProxyCreditDownAmount",
		dataIndex: "officerProxyCreditDownAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("officerProxyCreditDownAmount", "$")(_text, record)}{" "}
				{renderNullableValue("officerProxyCreditDownTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.official_give_agent_credit_down_points")}</p>
				<p>{newFormat("report.credit_down_points_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportProxyBeCreditDownAmount: {
		key: "proxyBeCreditDownAmount",
		dataIndex: "proxyBeCreditDownAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("proxyBeCreditDownAmount", "$")(_text, record)}{" "}
				{renderNullableValue("proxyBeCreditDownTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.agent_superior_credit_down_points")}</p>
				<p>{newFormat("report.credit_down_points_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportProxyToChildCreditDownAmount: {
		key: "proxyToChildCreditDownAmount",
		dataIndex: "proxyToChildCreditDownAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("proxyToChildCreditDownAmount", "$")(_text, record)}{" "}
				{renderNullableValue("proxyToChildCreditDownTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.agent_give_subordinate_credit_down_points")}</p>
				<p>{newFormat("report.credit_down_points_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportProxyToMemCreditDownAmount: {
		key: "proxyToMemCreditDownAmount",
		dataIndex: "proxyToMemCreditDownAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("proxyToMemCreditDownAmount", "$")(_text, record)}{" "}
				{renderNullableValue("proxyToMemCreditDownTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.agent_give_member_credit_down_points")}</p>
				<p>{newFormat("report.credit_down_points_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportOfficialHelpProxyCreditRepayAmount: {
		key: "officialHelpProxyCreditRepayAmount",
		dataIndex: "officialHelpProxyCreditRepayAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("officialHelpProxyCreditRepayAmount", "$")(_text, record)}{" "}
				{renderNullableValue("officialHelpProxyCreditRepayTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.official_help_proxy_credit_repay_amount")}</p>
				<p>{newFormat("report.credit_repayment_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportParentProxyHelpProxyCreditRepayAmount: {
		key: "parentProxyHelpProxyCreditRepayAmount",
		dataIndex: "parentProxyHelpProxyCreditRepayAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("parentProxyHelpProxyCreditRepayAmount", "$")(_text, record)}{" "}
				{renderNullableValue("parentProxyHelpProxyCreditRepayTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.parent_proxy_help_proxy_credit_repay_amount")}</p>
				<p>{newFormat("report.credit_repayment_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportProxyHelpSubProxyCreditRepayAmount: {
		key: "proxyHelpSubProxyCreditRepayAmount",
		dataIndex: "proxyHelpSubProxyCreditRepayAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("proxyHelpSubProxyCreditRepayAmount", "$")(_text, record)}{" "}
				{renderNullableValue("proxyHelpSubProxyCreditRepayTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.proxy_help_sub_proxy_credit_repay_amount")}</p>
				<p>{newFormat("report.credit_repayment_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportProxyHelpSubMemberCreditRepayAmount: {
		key: "proxyHelpSubMemberCreditRepayAmount",
		dataIndex: "proxyHelpSubMemberCreditRepayAmount",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("proxyHelpSubMemberCreditRepayAmount", "$")(_text, record)}{" "}
				{renderNullableValue("proxyHelpSubMemberCreditRepayTimes")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.proxy_help_sub_member_credit_repay_amount")}</p>
				<p>{newFormat("report.credit_repayment_times")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportWalletBalance: {
		key: "walletBalance",
		dataIndex: "walletBalance",
		width: 120,
		render: renderNullableValue("walletBalance", "$"),
		title: newFormat("report.center_wallet_balance"),
		align: "center",
		fixed: false
	},
	proxyReportCreditBalance: {
		key: "creditBalance",
		dataIndex: "creditBalance",
		width: 120,
		render: renderNullableValue("creditBalance", "$"),
		title: newFormat("report.alr_creditBalance"),
		align: "center",
		fixed: false
	},
	proxyReportCreditQuota: {
		key: "creditQuota",
		dataIndex: "creditQuota",
		width: 120,
		render: renderNullableValue("creditQuota", "$"),
		title: newFormat("report.credit_limit"),
		align: "center",
		fixed: false
	},
	proxyReportReturnLoan: {
		key: "returnLoan",
		dataIndex: "returnLoan",
		width: 120,
		render: renderNullableValue("returnLoan", "$"),
		title: newFormat("report.payable_accounts"),
		align: "center",
		fixed: false
	},
	proxyReportDirectlyUnderProxyNum: {
		key: "directlyUnderProxyNum",
		dataIndex: "directlyUnderProxyNum",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("directlyUnderProxyNum")(_text, record)} {renderNullableValue("underProxyNum")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.proxy_num")}</p>
				<p>{newFormat("report.sub_proxy_num")}</p>
			</>
		),
		align: "center",
		fixed: false
	},
	proxyReportDirectlyUnderMemberNum: {
		key: "directlyUnderMemberNum",
		dataIndex: "directlyUnderMemberNum",
		width: 180,
		render: (_text: any, record: any) => (
			<>
				{renderNullableValue("directlyUnderMemberNum")(_text, record)} {renderNullableValue("underMemberNum")(_text, record)}
			</>
		),
		title: () => (
			<>
				<p>{newFormat("report.member_num")}</p>
				<p>{newFormat("report.sub_member_num")}</p>
			</>
		),
		align: "center",
		fixed: false
	}
})

export default businessProxyReport
